#include "mem_sal.h"


/* 内存管理 */

void dfs_mem_free(void *ptr)
{
    mem_dtcm_free(ptr);
}

void *dfs_mem_malloc(unsigned int bytes)
{
    return mem_dtcm_malloc(bytes);
}

void *dfs_mem_realloc(void *ptr, unsigned int bytes)
{
    return mem_dtcm_realloc(ptr, bytes);
}

void *dfs_mem_calloc(size_t cnt, size_t bytes)
{
    return mem_dtcm_calloc(cnt, bytes);
}

char *dfs_mem_strdup(const char *s)
{
    uint32_t len = strlen(s) + 1;

    char *tmp = (char *)mem_dtcm_malloc(len);
    if (!tmp) return NULL;

    memcpy(tmp, s, len);

    return tmp;
}

